﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using FCDB.Entity;
namespace FCDB.Web.Models
{
    public class CompanyInfo
    {
      
       static public Hashtable intValue()
       {  
           Hashtable companyInfo = new Hashtable();
           companyInfo.Add("珠海", "(Yeas)富珠诉保第NO号");
           companyInfo.Add("中山", "(Yeas)富中山诉保第NO号");
           companyInfo.Add("宝安", "(Yeas)富宝诉保第NO号");
           companyInfo.Add("东莞", "富昌诉保（东二）第NO号");
           companyInfo.Add("福田", "(Yeas)富福诉保第NO号");
           companyInfo.Add("龙岗", "(Yeas)富龙诉保NO号");
           companyInfo.Add("罗湖", "(Yeas)富罗诉保第NO号");
           companyInfo.Add("梅州", "(Yeas)富梅诉保第NO号");
           companyInfo.Add("前海", "(Yeas)富昌诉保（前海）第NO号");
           companyInfo.Add("韶关", "(Yeas)富韶关诉保第NO号");
           companyInfo.Add("广东省高级人民法院", "(Yeas)富高院诉保第NO号"); 
           companyInfo.Add("盐田", "(Yeas)富昌诉保（盐田）第NO号");
           companyInfo.Add("深圳市中级人民法院", "(Yeas)富昌诉保（中法）第NO号");
           companyInfo.Add("惠州", "(Yeas)富惠诉保第NO号");
           companyInfo.Add("南山", "(Yeas)富南诉保第NO号");
           companyInfo.Add("佛山", "(Yeas)富佛诉保第NO号");
           companyInfo.Add("江门", "(Yeas)富江门诉保第NO号");
           companyInfo.Add("广州", "(Yeas)广州诉保第NO号");
           return companyInfo;
       }
       public List<String> getName()
       {
           Hashtable companyInfo = intValue();
           List<String> name= new List<String>();
           foreach(DictionaryEntry de in companyInfo) 
            {
                name.Add(de.Key.ToString());
            }
           return name;
       }

       public String getNo(String name, int count,FormCDB form)
       {
           count = count + 1;
           Hashtable companyInfo = intValue();
           String no = "";
           foreach (DictionaryEntry de in companyInfo)
           {
               String mapName = de.Key.ToString();
               if (name.Contains(mapName))
               {
                   no = de.Value.ToString();
                   break;
               }
           }
           if (String.IsNullOrEmpty(no))
           {
               no = "(Yeas)富X诉保第NO号";
               no = no.Replace("X", name.Substring(0,1));
           }
           DateTime time = DateTime.Now;
          no= no.Replace("Yeas", time.Year + "");
          no = no.Replace("DATE", time.Year + "" + time.Month + time.Day);
          String compayInfoNo = DateTime.Now.ToString("yyyyMMdd");
          if (count < 10)
          {
              compayInfoNo = compayInfoNo + "-00" + count;
          }
          if (count >= 10 && count < 100)
          {
              compayInfoNo = compayInfoNo + "-0" + count;
          }
          if (count >= 100)
          {
              compayInfoNo = compayInfoNo + "-" + count;
          }
          no = no.Replace("NO", compayInfoNo + "");
           return no;
       }

    }
}